header.navbar.navbar-expand-lg.navbar-light.bg-light
  .container
    = link_to Siteconf.site_name, root_path, class: 'navbar-brand'
    button.navbar-toggler(
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation")
      span.navbar-toggler-icon

    .collapse.navbar-collapse#navbarSupportedContent
      ul.navbar-nav.mr-auto
        - NavLink.default_order.each do |link|
          - if link.url.start_with?('http://')
            li.nav-item
              = link_to link.title, link.url, target: :_blank, class: 'nav-link'
          - else
            li.nav-item= link_to link.title, link.url, class: 'nav-link'


      - if user_signed_in?
        ul.navbar-nav
          li.dropdown
            = link_to 'javascript:void(0);', class: 'dropdown-toggle rabel', data: {toggle: 'dropdown'} do
              = current_user.nickname
            .dropdown-menu
              = link_to '个人主页', member_path(current_user.nickname),
                class: 'dropdown-item'
              = link_to '账号设置', settings_path, class: 'dropdown-item'
              - if current_user.can_manage_site?
                = link_to t(:dashboard), admin_root_path, class: 'dropdown-item'
              = link_to t(:sign_out), destroy_user_session_path,
                :method => :delete, :class => 'dropdown-item'

